package org.lisa.crm.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.lisa.crm.dao.CustomerRepriDao;
import org.lisa.crm.model.CustomerRepri;
import org.lisa.crm.service.CustomerRepriService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * Created by admin on 2018/2/4.
 */
@Service
public class CustomerRepriServiceImpl implements CustomerRepriService {


    @Autowired
    private CustomerRepriDao customerRepriDao;

    @Override
    public Map<String, Object> customerReprievesByLossId(int lossId,int page,int rows) {

        PageHelper.startPage(page,rows);

        List<CustomerRepri> list = customerRepriDao.customerReprievesByLossId(lossId);

        PageInfo<CustomerRepri> info = new PageInfo<>(list);

        Map<String,Object> map= new HashMap<>();

        map.put("total",info.getTotal());

        map.put("rows",info.getList());

        return map;
    }

}
